class Util {
    /* 时间mm:ss转秒 */
    static formDateToSecond = (date) => {
        let min = parseInt(date.split(":")[0], 10);
        let second = parseInt(date.split(":")[1], 10);
        return min * 60 + second;
    }

    /* 秒数转时间mm:ss */
    static formSecondToDate = (second) => {
        let min = Math.floor(second / 60);
        let sec = Math.floor(second % 60);
        if (min < 10) {
            min = '0' + min;
        }
        if (sec < 10) {
            sec = '0' + sec;
        }
        return min + ":" + sec;
    }
}

export default Util;